package factory.impl;

import factory.GUIFactory;
import service.Button;
import service.CheckBox;
import service.TextField;
import service.impl.LinuxButton;

/**
 * Linux风格GUI工厂 - 扩展工厂
 */
public class LinuxGUIFactory implements GUIFactory {
    
    @Override
    public Button createButton() {
        return new LinuxButton();
    }
    
    @Override
    public TextField createTextField() {
        // 返回Linux风格文本框，这里简化实现
        return new TextField() {
            private String text;
            private String placeholder;
            
            @Override
            public void render() {
                System.out.println("渲染Linux风格文本框");
                System.out.println("  - 简单边框");
                if (placeholder != null && (text == null || text.isEmpty())) {
                    System.out.println("  - 占位符: " + placeholder);
                } else {
                    System.out.println("  - 文本: " + text);
                }
            }
            
            @Override
            public void setText(String text) { this.text = text; }
            @Override
            public String getText() { return text; }
            @Override
            public void setPlaceholder(String placeholder) { this.placeholder = placeholder; }
        };
    }
    
    @Override
    public CheckBox createCheckBox() {
        // 返回Linux风格复选框，这里简化实现
        return new CheckBox() {
            private boolean checked;
            private String label;
            
            @Override
            public void render() {
                System.out.println("渲染Linux风格复选框: " + label);
                System.out.println("  - [ ] 简单方框");
                System.out.println("  - 状态: " + (checked ? "选中" : "未选中"));
            }
            
            @Override
            public void setChecked(boolean checked) { this.checked = checked; }
            @Override
            public boolean isChecked() { return checked; }
            @Override
            public void setLabel(String label) { this.label = label; }
        };
    }
    
    @Override
    public String getDialogStyle() {
        return "Linux风格对话框 - 简洁风格，无特效";
    }
}